﻿package com.kgame5.xtank3d.app.view.gbook.pageloading {
import kgame5.kgfw.gbook.PageComp;

import com.kgame5.xtank3d.app.AppEnum;
import com.kgame5.xtank3d.resource.ResourceManagerX;

import flash.display.MovieClip;
import flash.events.Event;

/**
 * @author kangkai
 */
public class PageLoadingComp extends PageComp{
	
	public function PageLoadingComp(p_mc:MovieClip){
		super(AppEnum.PAGEID_LOADING,p_mc);
		
		//动画停下，节约资源
		mc.mc_loading.stop();
	}
	
	override public function onCreate():void{
		mc.mc_loading.gotoAndPlay(1);//操作提示，这个保证不浪费资源
		
		//
		ResourceManagerX.getInstance().addEventListener(Event.COMPLETE, onOK);
		ResourceManagerX.getInstance().start(1);//levelID
	}
	
//		if(ResourceManagerX.getInstance().isOK()){
//			T.p("完毕");
//			this.gotoState_Play();
		
	
	override public function onRelease():void{
		mc.mc_loading.stop();//操作提示，这个保证不浪费资源
	}
	
	//--事件
	private function onOK(e:Event):void{
		this.dispatchEvent(new Event(Event.COMPLETE));
	}
	
}//end of class
}
